/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-06-13
 * Time: 19:20
 */

import java.util.ArrayList;

/**
 * 删除，str1中出现的，所有str2字符
 */
public class TestString {
    public static void main(String[] args) {
        String str1 = "hello haha";
        String str2 = "ea";
        ArrayList<Character> list = new ArrayList<>();
        for (int i = 0; i < str1.length(); i++) {
            //拿出str1中的字符
            char ch = str1.charAt(i);

            //如果str2中不包含，从str1中遍历的'ch'，那么就加到集合里面
            if (!str2.contains(ch+""/*这里ch不是字符串，可以加”("")“来转为字符串，这是个编程经验 ！*/)) {
                list.add(ch);
            }
        }

        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i) + " ");
        }
    }
}
